package com.o2o.enums;

/**
 * package_name:com.o2o.enums
 * Author:徐亚远
 * Date:2019/11/28 14:32
 * 项目名:o2o
 * Desription:
 **/
public enum ShopStateEnum {
    CHECK(0, "审核中"), OFFINE(-1, "非法店铺"), SUCCESS(1, "操作成功"),
    NULL_SHOPID(-1002, "ShopId为空"), NUL_SHOP(-1004, "Shop信息为空"), NULL_SHOP_INFO(
            -1003, "传入了空的信息"), INNER_ERROR(
            -1001, "操作失败"),;
    private int state;
    private String stateInfo;

    private ShopStateEnum(int state, String stateInfo) {
        this.state = state;
        this.stateInfo = stateInfo;
    }

    /*
     * 依据传入的state返回相应的enum值
     * */
    public static ShopStateEnum stateOf(int state) {
        for (ShopStateEnum stateEnum : values()) {
            if (stateEnum.getState() == state) {
                return stateEnum;
            }
        }
        return null;
    }

    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }
}
